<template>
  <div class="layout-padding">
    <!-- 设备列表清单 -->
    <!-- <el-button type="primary" @click="onttt">确 定</el-button> -->
    <el-card shadow="hover" class="layout-padding-auto">
      <el-tabs
        v-model="activeName"
        class="demo-tabs"
        @tab-click="handleClick"
        @tab-change="tabChange"
      >
        <el-tab-pane label="未点检任务" name="1">
          <template #label>
            <span class="custom-tabs-label">
              <span>未点检任务</span>
              <el-tooltip placement="bottom" effect="light">
                <template #content
                  >任务将按计划定时生成，<br />仅显示当天未点检任务</template
                >
                <el-icon><Warning /></el-icon>
              </el-tooltip>
            </span>
          </template>
          <TableSearch
            :search="state.search"
            @search="onSearch"
            @listenClick="listenClick"
          />
          <Table
            ref="tableRef"
            v-bind="state.tableData"
            class="table-demo"
            @pageChange="onTablePageChange"
            @listenClick="listenClick"
          >
            <template #default="{ slotData, slotColumn }">
              <div v-if="slotColumn.key === 'checkStatus'">
                {{
                  slotData.checkStatus == 0
                    ? '待点检'
                    : slotData.checkStatus == 1
                    ? '点检中'
                    : slotData.checkStatus == 2
                    ? '点检完成'
                    : slotData.checkStatus == 9
                    ? '已取消'
                    : ''
                }}
              </div>
            </template>
          </Table>
        </el-tab-pane>
        <el-tab-pane label="已点检任务" name="2">
          <TableSearch
            :search="state.search2"
            @search="onSearch2"
            @listenClick="listenClick2"
          />
          <Table
            ref="tableRef"
            v-bind="state.tableData2"
            class="table-demo"
            @pageChange="onTablePageChange2"
            @listenClick="listenClick2"
            @dataList="dataList"
          >
            <template #default="{ slotData, slotColumn }">
              <div v-if="slotColumn.key === 'checkStatus'">
                <span v-if="slotData.checkStatus == 9">
                  已关闭
                  <el-popover
                    placement="top-start"
                    title="关闭原因"
                    :width="200"
                    trigger="hover"
                    :content="slotData.closeReason"
                  >
                    <template #reference>
                      <svg
                        t="1681107624752"
                        class="icon"
                        viewBox="0 0 1024 1024"
                        version="1.1"
                        xmlns="http://www.w3.org/2000/svg"
                        p-id="3558"
                        width="20"
                        height="20"
                      >
                        <path
                          d="M976.738462 704.984615c27.569231-63.015385 39.384615-129.969231 39.384615-196.923077s-11.815385-133.907692-39.384615-196.923076S913.723077 196.923077 866.461538 149.661538c-47.261538-47.261538-102.4-82.707692-161.476923-110.276923-63.015385-27.569231-129.969231-39.384615-196.923077-39.384615s-133.907692 11.815385-196.923076 39.384615S196.923077 102.4 149.661538 149.661538 66.953846 248.123077 39.384615 311.138462c-27.569231 63.015385-39.384615 129.969231-39.384615 196.923076s11.815385 133.907692 39.384615 196.923077c27.569231 59.076923 63.015385 114.215385 110.276923 161.476923 47.261538 47.261538 102.4 82.707692 161.476924 110.276924 63.015385 27.569231 129.969231 39.384615 196.923076 39.384615s133.907692-11.815385 196.923077-39.384615c59.076923-27.569231 114.215385-63.015385 161.476923-110.276924 47.261538-47.261538 82.707692-98.461538 110.276924-161.476923z m-31.507693-196.923077c0 59.076923-11.815385 114.215385-35.446154 169.353847-23.630769 51.2-55.138462 98.461538-94.523077 137.846153s-86.646154 70.892308-137.846153 94.523077c-55.138462 23.630769-110.276923 35.446154-169.353847 35.446154s-114.215385-11.815385-169.353846-35.446154c-51.2-23.630769-98.461538-55.138462-137.846154-94.523077s-70.892308-86.646154-94.523076-137.846153c-23.630769-55.138462-35.446154-110.276923-35.446154-169.353847s11.815385-114.215385 35.446154-169.353846C126.030769 283.569231 157.538462 240.246154 200.861538 196.923077c39.384615-39.384615 86.646154-70.892308 137.846154-94.523077 55.138462-23.630769 110.276923-35.446154 169.353846-35.446154s114.215385 11.815385 169.353847 35.446154c55.138462 23.630769 98.461538 55.138462 141.784615 94.523077 39.384615 39.384615 70.892308 86.646154 94.523077 137.846154 19.692308 59.076923 31.507692 114.215385 31.507692 173.292307z"
                          fill="#C2C2C2"
                          p-id="3559"
                        ></path>
                        <path
                          d="M508.061538 153.6c-47.261538 0-90.584615 39.384615-90.584615 90.584615s39.384615 90.584615 90.584615 90.584616 90.584615-39.384615 90.584616-90.584616-43.323077-90.584615-90.584616-90.584615zM464.738462 823.138462c3.938462 7.876923 3.938462 11.815385 11.815384 15.753846 3.938462 3.938462 7.876923 7.876923 15.753846 11.815384 7.876923 3.938462 11.815385 3.938462 19.692308 3.938462h7.876923c3.938462 0 7.876923 0 7.876923-3.938462 3.938462 0 3.938462-3.938462 7.876923-3.938461 3.938462-3.938462 3.938462-3.938462 7.876923-3.938462 0-3.938462 3.938462-3.938462 3.938462-7.876923s3.938462-3.938462 3.938461-7.876923 3.938462-3.938462 3.938462-7.876923v-7.876923h-47.261539 47.261539v-354.461539-7.876923c0-3.938462 0-7.876923-3.938462-7.876923 0-3.938462-3.938462-3.938462-3.938461-7.876923s-3.938462-3.938462-3.938462-7.876923c-3.938462 0-3.938462-3.938462-7.876923-3.938461s-3.938462-3.938462-7.876923-3.938462-3.938462-3.938462-7.876923-3.938461H512h-7.876923c-3.938462 0-7.876923 0-7.876923 3.938461-3.938462 0-3.938462 3.938462-7.876923 3.938462-3.938462 3.938462-3.938462 3.938462-7.876923 3.938461 0 3.938462-3.938462 3.938462-3.938462 7.876923s-3.938462 3.938462-3.938461 7.876923-3.938462 7.876923-3.938462 7.876923v7.876923h47.261539-47.261539v354.461539c-7.876923 0-7.876923 3.938462-3.938461 11.815385z"
                          fill="#C2C2C2"
                          p-id="3560"
                        ></path>
                      </svg>
                    </template>
                  </el-popover>
                </span>
                <span v-else>{{
                  slotData.checkStatus == 0
                    ? '待点检'
                    : slotData.checkStatus == 1
                    ? '点检中'
                    : slotData.checkStatus == 2
                    ? '点检完成'
                    : slotData.checkStatus == 3
                    ? '逾期未点检'
                    : ''
                }}</span>
              </div>
              <div v-else-if="slotColumn.key === 'checkResult'">
                {{
                  slotData.checkResult == 1
                    ? '正常'
                    : slotData.checkResult == 2
                    ? '异常'
                    : '-'
                }}
              </div>
            </template>
          </Table>
        </el-tab-pane>
      </el-tabs>
      <TaskDetail
        :dialogVisible="dialogVisible"
        :dialogForm="dialogForm"
        @closeDetail="closeDetail"
      ></TaskDetail>
      <CancelTask
        :cancelDialog="cancelDialog"
        :cancelId="cancelId"
        @closeCancel="closeCancel"
        @closeSubmit="closeSubmit"
      ></CancelTask>
      <TransmitTaskDialog
        :addDialog="transmitDialog"
        :primaryForm="primaryForm"
        @addCancel="closeTransmit"
        @addSubmit="submitTransmit"
      ></TransmitTaskDialog>
      <MoreTransmitTaskDialog
        :addDialog="transmitMoreDialog"
        :primaryForm="primaryMoreForm"
        @addCancel="closeMoreTransmit"
        @addSubmit="submitMoreTransmit"
      ></MoreTransmitTaskDialog>
    </el-card>
  </div>
</template>
<script lang="ts">
const activeName = ref('1')
export default defineComponent({
  beforeRouteEnter(to, from, next) {
    next((vm) => {
      if (from.name == 'repairOrderDetail') {
        activeName.value = '2'
      } else {
        activeName.value = '1'
      }
    })
  }
})
</script>
<script setup lang="ts">
import {
  ref,
  watch,
  reactive,
  onMounted,
  defineAsyncComponent,
  defineComponent
} from 'vue'
import {
  ElMessage,
  ElMessageBox,
  TabsPaneContext,
  TabPaneName
} from 'element-plus'
import { TableDemoPageType } from '/@/types/views'
import { dictionaryList } from '/@/api/publicApi'
import {
  deleteMaintainTaskApi,
  derivedMaintainPolicyApi,
  getDJTaskInfoApi
} from '/@/api/check'
import { router } from '/@/router'
import { getButtonListByRoleApi } from '/@/api/publicApi'
import { Session } from '/@/utils/storage'
import { Warning } from '@element-plus/icons-vue'

const menu = Session.get('menu')
const buttonCodes = ref<any>([])
const Table = defineAsyncComponent(
  () => import('/@/components/table/index.vue')
)
const TableSearch = defineAsyncComponent(
  () => import('/@/components/table/search.vue')
)
const TaskDetail = defineAsyncComponent(
  () => import('./components/TaskDetail.vue')
)
const CancelTask = defineAsyncComponent(
  () => import('./components/CancelTask.vue')
)
const TransmitTaskDialog = defineAsyncComponent(
  () => import('./components/TransmitTaskDialog.vue')
)
const MoreTransmitTaskDialog = defineAsyncComponent(
  () => import('./components/MoreTransmitTaskDialog.vue')
)
const dialogVisible = ref<boolean>(false) //弹窗是否出现
const dialogForm = ref<any>({
  title: '',
  form: <any>{},
  type: '',
  code: 0
})

// const activeName = ref('1')
// 定义变量内容
const tableRef = ref<RefType>()
const state = reactive<any>({
  tableData: {
    flash: false, // 刷新表格
    // 表头内容（必传，注意格式）
    header: [
      {
        key: 'taskOrderNum',
        colWidth: '200',
        title: '点检工单号',
        type: 'text'
      },
      { key: 'deviceNum', colWidth: '', title: '设备编号', type: 'text' },
      { key: 'deviceName', colWidth: '', title: '设备名称', type: 'text' },
      { key: 'seatNum', colWidth: '', title: '位置号', type: 'text' },
      { key: 'checkTypeName', colWidth: '', title: '点检类型', type: 'text' },
      {
        key: 'planBeginDate',
        colWidth: '170',
        title: '计划开始时间',
        type: 'text'
      },
      {
        key: 'factBeginDate',
        colWidth: '170',
        title: '实际开始时间',
        type: 'text'
      },
      { key: 'checkUserName', colWidth: '', title: '点检人', type: 'text' },
      { key: 'checkStatus', colWidth: '', title: '任务状态', type: 'slot' }
    ],
    columnBtn: [
      {
        name: 'taskDetail',
        text: '任务详情',
        hide(row: any): boolean {
          return true
        },
        type: 'primary',
        btns: buttonCodes.value,
        btnCode: 'djtDetailBtn'
      },
      {
        name: 'cancelTask',
        text: '关闭点检',
        hide(row: any): boolean {
          return row.checkStatus != 1 && row.checkStatus != 2
        },
        type: 'warning',
        btns: buttonCodes.value,
        btnCode: 'djtCancelBtn'
      },
      {
        name: 'transmitTask',
        text: '点检转交',
        hide(row: any): boolean {
          return true
        },
        type: 'success',
        btns: buttonCodes.value,
        btnCode: 'djtTransmitBtn'
      },
      {
        name: 'delTask',
        text: '删除',
        hide(row: any): boolean {
          return row.checkStatus != 1
        },
        type: 'danger',
        btns: buttonCodes.value,
        btnCode: 'djtDeleteBtn'
      }
    ],
    // 配置项（必传）
    config: {
      listApi: '/device/mobile/deviceCheckTask/webPageList',
      listHttp: 'post',
      total: 0, // 列表总数
      loading: true, // loading 加载
      noPage: false, // 是否分页
      isSerialNo: false, // 是否显示表格序号
      isSelection: false, // 是否显示表格多选
      isOperate: true, // 是否显示表格操作栏
      isExtend: false, // 是否可以扩展
      operateWidth: '400', //操作栏宽度
      fixed: 'right' //操作栏固定
    },
    // 搜索参数
    param: {
      checkedFlag: 0 // 必传参数，分页的不要传
    }
  },
  tableData2: {
    flash: false, // 刷新表格
    // 表头内容（必传，注意格式）
    header: [
      {
        key: 'taskOrderNum',
        colWidth: '200',
        title: '点检工单号',
        type: 'text'
      },
      { key: 'deviceNum', colWidth: '120', title: '设备编号', type: 'text' },
      { key: 'deviceName', colWidth: '120', title: '设备名称', type: 'text' },
      { key: 'seatNum', colWidth: '', title: '位置号', type: 'text' },
      {
        key: 'checkTypeName',
        colWidth: '120',
        title: '点检类型',
        type: 'text'
      },
      {
        key: 'factBeginDate',
        colWidth: '180',
        title: '点检开始时间',
        type: 'text'
      },
      {
        key: 'factEndDate',
        colWidth: '180',
        title: '点检结束时间',
        type: 'text'
      },
      { key: 'checkUserName', colWidth: '', title: '点检人', type: 'text' },
      { key: 'checkStatus', colWidth: '120', title: '任务状态', type: 'slot' },
      { key: 'checkResult', colWidth: '120', title: '点检结果', type: 'slot' },
      { key: 'checkFee', colWidth: '120', title: '费用(元)', type: 'text' }
    ],
    columnBtn: [
      {
        name: 'detail',
        text: '详情',
        hide(row: any): boolean {
          return true
        },
        type: 'primary',
        btns: buttonCodes.value,
        btnCode: 'ydjtDetailBtn'
      },
      {
        name: 'exportWebao',
        text: '导出点检单',
        hide(row: any): boolean {
          return true
        },
        type: 'primary',
        btns: buttonCodes.value,
        btnCode: 'ydjtExportBtn'
      },
      {
        name: 'deleteWebao',
        text: '删除',
        hide(row: any): boolean {
          return false
        },
        type: 'danger',
        btns: buttonCodes.value,
        btnCode: 'ydjtDeleteBtn'
      }
    ],
    // 配置项（必传）
    config: {
      listApi: '/device/mobile/deviceCheckTask/webPageList',
      listHttp: 'post',
      total: 0, // 列表总数
      loading: true, // loading 加载
      noPage: false, // 是否分页
      isSerialNo: false, // 是否显示表格序号
      isSelection: false, // 是否显示表格多选
      isOperate: true, // 是否显示表格操作栏
      isExtend: false, // 是否可以扩展
      operateWidth: '350', //操作栏宽度
      fixed: 'right' //操作栏固定
    },
    // 搜索参数
    param: {
      checkedFlag: 1 // 必传参数，分页的不要传
    }
  },
  // 搜索表单，动态生成（传空数组时，将不显示搜索，注意格式）
  search: {
    param: [
      {
        label: '',
        prop: 'keyword',
        placeholder: '输入点检设备、编号、点检人搜索',
        type: 'input'
      },
      {
        label: '时间筛选',
        prop: 'daterange',
        placeholder: '请选择开始时间-结束时间',
        type: 'daterange'
      },
      {
        label: '点检类型',
        prop: 'checkType',
        placeholder: '点检类型',
        options: [],
        type: 'select'
      }
    ],
    btn: [
      {
        text: '批量转交',
        fun: 'batchTransmit',
        disable: false,
        loading: false,
        type: 'primary',
        hide(): boolean {
          return false
        },
        btns: buttonCodes.value,
        btnCode: 'djtBatchTransmitBtn'
      },
      {
        text: '转交记录',
        fun: 'transmitRecord',
        disable: false,
        loading: false,
        type: 'primary',
        hide(): boolean {
          return false
        },
        btns: buttonCodes.value,
        btnCode: 'djtTransmitRecordBtn'
      }
    ],
    reset: true
  },
  // 搜索表单，动态生成（传空数组时，将不显示搜索，注意格式）
  search2: {
    param: [
      {
        label: '',
        prop: 'keyword',
        placeholder: '输入点检设备、编号、点检人搜索',
        type: 'input'
      },
      {
        label: '时间筛选',
        prop: 'daterange',
        placeholder: '请选择开始时间-结束时间',
        type: 'daterange'
      },
      //   { label: '点检类型', prop: 'checkType', placeholder: '点检类型', options: [], type: 'cascader' },
      {
        label: '任务状态',
        prop: 'checkStatus',
        placeholder: '任务状态',
        options: [
          // { id: 0, configValue: '待执行' },
          { id: '', configValue: '全部' },
          { id: 2, configValue: '点检完成' },
          { id: 3, configValue: '逾期未点检' },
          { id: 9, configValue: '已关闭' }
        ],
        type: 'select'
      },
      {
        label: '点检结果',
        prop: 'checkResult',
        placeholder: '点检结果',
        options: [
          { id: '', configValue: '全部' },
          { id: 1, configValue: '正常' },
          { id: 2, configValue: '异常' }
        ],
        type: 'select'
      }
    ],
    btn: [
      {
        text: '批量导出点检',
        fun: 'batchExportWebao',
        disable: false,
        loading: false,
        type: 'primary',
        hide(): boolean {
          return false
        },
        btns: buttonCodes.value,
        btnCode: 'ydjtBatchExportBtn'
      }
    ],
    reset: true
  }
})

const getMaintainType = () => {
  dictionaryList({ configType: 'check_type', keyword: '' }).then((res) => {
    if (res.code == 0) {
      state.search.param.forEach((i: any) => {
        if (i.prop == 'checkType') {
          i.options = res.data
          i.options.unshift({
            configValue: '全部',
            customizeFlag: 1,
            parentId: '0',
            id: ''
          })
        }
      })
      // state.search2.param.forEach((i: any) => {
      //   if (i.prop == 'checkType') {
      //     i.options = res.data
      //   }
      // });
    }
  })
}
getMaintainType()

// 初始化列表数据
const getTableData = () => {
  state.tableData.flash = !state.tableData.flash
}
// 搜索点击时表单回调
const onSearch = (data: EmptyObjectType) => {
  state.tableData.param = Object.assign({}, state.tableData.param, { ...data })
  if (
    state.tableData.param.daterange &&
    state.tableData.param.daterange.length != 0
  ) {
    state.tableData.param.startTime = state.tableData.param.daterange[0]
    state.tableData.param.endTime = state.tableData.param.daterange[1]
  } else {
    state.tableData.param.startTime = ''
    state.tableData.param.endTime = ''
  }
  state.tableData.flash = !state.tableData.flash
}
// 分页改变时回调
const onTablePageChange = (page: TableDemoPageType) => {
  state.tableData.param.pageNum = page.pageNum
  state.tableData.param.pageSize = page.pageSize
  getTableData()
}
// 初始化列表数据
const getTableData2 = () => {
  state.tableData2.flash = !state.tableData2.flash
}

const list = ref([])
const dataList = (val: any) => {
  list.value = val.records
}

// 搜索点击时表单回调
const onSearch2 = (data: EmptyObjectType) => {
  state.tableData2.param = Object.assign({}, state.tableData2.param, {
    ...data
  })
  if (
    state.tableData2.param.daterange &&
    state.tableData2.param.daterange.length != 0
  ) {
    state.tableData2.param.startTime = state.tableData2.param.daterange[0]
    state.tableData2.param.endTime = state.tableData2.param.daterange[1]
  } else {
    state.tableData2.param.startTime = ''
    state.tableData2.param.endTime = ''
  }
  state.tableData2.flash = !state.tableData2.flash
}
// 分页改变时回调
const onTablePageChange2 = (page: TableDemoPageType) => {
  state.tableData2.param.pageNum = page.pageNum
  state.tableData2.param.pageSize = page.pageSize
  getTableData2()
}

//打开任务详情
const taskDetail = (row: any) => {
  getDJTaskInfoApi(row.id).then((res) => {
    if (res.code == 0) {
      dialogForm.value.form = res.data
      dialogForm.value.title = row.taskOrderNum
      if (activeName.value == '1') {
        dialogForm.value.type = '0'
      } else {
        dialogForm.value.type = '1'
      }
      dialogVisible.value = !dialogVisible.value
    }
  })
}
const closeDetail = () => {
  dialogForm.value = {
    form: {},
    title: '',
    type: ''
  }
  dialogVisible.value = !dialogVisible.value
}

const cancelDialog = ref(false)
const cancelId = ref('')
//取消点检
const cancelTask = (row: any) => {
  cancelId.value = row.id
  cancelDialog.value = !cancelDialog.value
}
const closeCancel = () => {
  cancelDialog.value = !cancelDialog.value
}

const closeSubmit = () => {
  getTableData()
  cancelDialog.value = !cancelDialog.value
}

//点检转交(单个)
const transmitDialog = ref(false)
const primaryForm = ref({})
const transmitTask = (row: any) => {
  primaryForm.value = row
  transmitDialog.value = !transmitDialog.value
}
const closeTransmit = () => {
  transmitDialog.value = !transmitDialog.value
  getTableData()
}
const submitTransmit = () => {
  transmitDialog.value = !transmitDialog.value
  getTableData()
}

//批量转交
const transmitMoreDialog = ref(false)
const primaryMoreForm = ref({})
const batchTransmit = (row: any) => {
  primaryMoreForm.value = row
  transmitMoreDialog.value = !transmitMoreDialog.value
}
const closeMoreTransmit = () => {
  transmitMoreDialog.value = !transmitMoreDialog.value
  getTableData()
}
const submitMoreTransmit = () => {
  transmitMoreDialog.value = !transmitMoreDialog.value
  getTableData()
}

//转交记录
const transmitRecord = (row: any) => {
  router.push({
    name: 'checkTransmitRecord'
  })
}

const handleClick = (tab: TabsPaneContext, event: Event) => {
  // console.log(tab, event);
}

//切换tab刷新表格数据
const tabChange = (name: TabPaneName) => {
  if (name === '1') {
    getTableData()
  } else {
    getTableData2()
  }
}

const delTask = (row: any) => {
  ElMessageBox.confirm('确认删除此条内容吗?', '提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning'
  })
    .then(() => {
      deleteMaintainTaskApi(row.id).then((res) => {
        if (res.code == 0) {
          ElMessage({
            type: 'success',
            message: '删除成功'
          })
          getTableData()
        }
      })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: '已取消'
      })
    })
}

let timer: any = null
const exportWebao = (row: any) => {
  timer && clearTimeout(timer)
  timer = setTimeout(() => {
    let params = {
      checkId: row.id
    }
    derivedMaintainPolicyApi(params).then((res) => {
      if (res.code == 0) {
        ElMessage.success('已导出,请在下载中心列表查看')
      }
    })
  }, 1000)
}

let timer2: any = null
const batchExportWebao = () => {
  timer2 && clearTimeout(timer2)
  timer2 = setTimeout(() => {
    let params = {
      checkStatus: state.tableData2.param.checkStatus
        ? state.tableData2.param.checkStatus
        : '',
      checkResult: state.tableData2.param.checkResult
        ? state.tableData2.param.checkResult
        : '',
      startTime: state.tableData2.param.startTime
        ? state.tableData2.param.startTime
        : '',
      keyword: state.tableData2.param.keyword
        ? state.tableData2.param.keyword
        : '',
      endTime: state.tableData2.param.endTime
        ? state.tableData2.param.endTime
        : ''
    }
    if (list.value.length == 0) {
      ElMessage.warning('暂无数据可导出')
    } else {
      derivedMaintainPolicyApi(params).then((res) => {
        if (res.code == 0) {
          ElMessage.success('已导出,请在下载中心列表查看')
        }
      })
    }
  }, 1000)
}

const callPreviousRouteMethod = () => {
  const matchedRoutes = router.currentRoute.value.matched
  const currentRouteIndex = matchedRoutes.length - 1
  if (currentRouteIndex >= 1) {
    const previousRoute = matchedRoutes[currentRouteIndex - 1]
    console.log(previousRoute)
  }
}

//定义方法对象 注意定义的方法 必须在上面已经申明 所以建议objFun申明和 listenClick方法 写在页面最下面
const objFun = {
  taskDetail: taskDetail,
  cancelTask: cancelTask,
  delTask: delTask,
  transmitTask: transmitTask,
  batchTransmit: batchTransmit,
  transmitRecord: transmitRecord
}

// 监听子级表格  传过来的方法
const listenClick = (name: string, val: any) => {
  objFun[name](val)
}

const objFun2 = {
  exportWebao: exportWebao,
  detail: taskDetail,
  batchExportWebao: batchExportWebao
}

// 监听子级表格  传过来的方法
const listenClick2 = (name: string, val: any) => {
  objFun2[name](val)
}

// 页面加载时
onMounted(() => {
  getTableData()
  getTableData2()
  callPreviousRouteMethod()
  menu.forEach(async (element: any) => {
    if (element.menuUrl == '/check/checkTask') {
      let res = await getButtonListByRoleApi({
        terminalType: 1,
        menuPid: element.id
      })
      res.data.forEach((item: any) => {
        buttonCodes.value.push(item.buttonCode)
      })
    }
  })
})
</script>

<style scoped lang="scss">
.custom-tabs-label {
  display: flex;
  justify-content: center;
  align-items: center;
}
</style>
